package net.keebook.webapp.entity;

import java.io.Serializable;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import net.keebook.webapp.util.ExposableId;

@Entity
@Cacheable
public class KeeBook implements Serializable, ExposableId {
	private static final long serialVersionUID = -5430471352820415478L;
	
	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;
	private String name;
	private String keyphraseChecksum;
	private String salt;
	@Column(unique=true)
	private String exposableId;
	
	public String getExposableId() {
		return exposableId;
	}
	public void setExposableId(String exposableId) {
		this.exposableId = exposableId;
	}
	public String getKeyphraseChecksum() {
		return keyphraseChecksum;
	}
	public void setKeyphraseChecksum(String keyphraseChecksum) {
		this.keyphraseChecksum = keyphraseChecksum;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getSalt() {
		return salt;
	}
	public void setSalt(String salt) {
		this.salt = salt;
	}
	
	@Override
	public boolean equals(Object o) {
		if (o instanceof KeeBook) {
			if (((KeeBook) o).getId() == getId()) {
				return true;
			}
		}
		return false;
	}
}
